import allure
from appium.webdriver.common.appiumby import AppiumBy

from tests.app.pages.member_setup_page import MemberSetupPage
from tests.app.pages.wecom import Wecom


class MemberPage(Wecom):
    __MEMBER_SETUP = AppiumBy.ID, 'com.tencent.wework:id/mhw'
    __MEMBERS_NAME = AppiumBy.XPATH, "//*[@resource-id='com.tencent.wework:id/h8p']"

    @allure.step('进入成员设置页面')
    def goto_member_setup_page(self):
        self.find_and_click(self.__MEMBER_SETUP)
        return MemberSetupPage(self.driver)

    @allure.step('获取成员名称列表')
    def get_members_name(self):
        members_name = self.finds(self.__MEMBERS_NAME)[1:]
        return members_name
